const app = getApp();
// 分层
const { getBookList } = require('../../api/index');

Page({
  data: {
    books: []
  },
  async onLoad() {
    let books = await getBookList();
    this.setData({
      books
    })
  },
  viewItem(e) {
    let { id } = e.currentTarget.dataset
    wx.navigateTo({
      url: '../detail/detail?id='+id
    })
  }
})